<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/pages/common/head.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title></title>
		<link rel="stylesheet" href="${resourceServer }/css/pintuer.css">
		<link rel="stylesheet" href="${resourceServer }/css/admin.css">
		<script src="${resourceServer }/js/jquery.js"></script>
		<script src="${resourceServer }/js/pintuer.js"></script>
	</head>

	<body>

	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder">商品列表</strong>

		</div>
		<div class="padding border-bottom">
			<ul class="search" style="padding-left:10px;">
				<li><button type="button" class="button border-yellow" onclick="window.location.href='${basepath}/product/add.do'"><span class="icon-plus-square-o"></span> 添加内容</button></li>
				<li>
					<form id="fm">
						<input type="text" placeholder="请输入搜索商品名" name="name" class="input" style="width:250px; line-height:17px;display:inline-block" value="${product.name }" />
						&nbsp;&nbsp;是否有效
						<select name="isDel" class="input"   style="width:60px; line-height:17px;display:inline-block">
							<option value="">全部</option>
							<option value="1" <c:if test="${product.isDel==1 }">selected="selected"</c:if>>是</option>
							<option value="0" <c:if test="${product.isDel==0 }">selected="selected"</c:if>>否</option>
						</select>
						&nbsp;&nbsp;是否热卖
						<select name="isHot" class="input"   style="width:60px; line-height:17px;display:inline-block">
							<option value="">全部</option>
							<option value="1" <c:if test="${product.isHot==1 }">selected="selected"</c:if>>是</option>
							<option value="0" <c:if test="${product.isHot==0 }">selected="selected"</c:if>>否</option>
						</select>
						&nbsp;&nbsp;是否推荐
						<select name="isCommmend" class="input"   style="width:60px; line-height:17px;display:inline-block">
							<option value="">全部</option>
							<option value="1" <c:if test="${product.isCommmend==1 }">selected="selected"</c:if>>是</option>
							<option value="0" <c:if test="${product.isCommmend==0 }">selected="selected"</c:if>>否</option>
						</select>
						&nbsp;&nbsp;是否新品
						<select name="isNew" class="input"   style="width:60px; line-height:17px;display:inline-block">
							<option value="">全部</option>
							<option value="1" <c:if test="${product.isNew==1 }">selected="selected"</c:if>>是</option>
							<option value="0" <c:if test="${product.isNew==0 }">selected="selected"</c:if>>否</option>
						</select>
						<button href="javascript:void(0)" class="button border-main icon-search" > 搜索</button>
					</form>
				</li>
			</ul>

		</div>
		<table class="table table-hover text-center">
			<thead>
			<tr>
				<th>编号</th>
				<th>商品名</th>
				<th>图片</th>
				<th>是否热卖</th>
				<th>是否新品</th>
				<th>是否推荐</th>
				<th>销量</th>
				<th>是否有效</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			<c:forEach items="${products }" var="entry">
				<tr>
					<td>${entry.id }</td>
					<td>${entry.name }</td>
					<td><img alt="商品图片" width="40" height="40" src='${imgServer}/${fn:split(entry.images, ",")[0]}'></td>
					<td>
						<c:if test="${entry.isHot==1 }">是</c:if>
						<c:if test="${entry.isHot==0 }">否</c:if>
					</td>
					<td>
						<c:if test="${entry.isNew==1 }">是</c:if>
						<c:if test="${entry.isNew==0 }">否</c:if>
					</td>
					<td>
						<c:if test="${entry.isCommmend==1 }">是</c:if>
						<c:if test="${entry.isCommmend==0 }">否</c:if>
					</td>
					<td>${entry.sales }</td>
					<td>
						<c:if test="${entry.isDel==0 }">有效</c:if>
						<c:if test="${entry.isDel==1 }">失效</c:if>
					</td>
					<td>
						<div class="button-group">
							<a class="button border-main" href="${basepath }/product/details.do?id=${entry.id}"><span class="icon-edit"></span> 查看</a>
							<a class="button border-main" href="${basepath }/sku/show.do?productId=${entry.id}"><span class="icon-edit"></span> sku</a>
							<a class="button border-main" href="${basepath }/product/update.do?id=${entry.id}"><span class="icon-edit"></span> 修改</a>
							<c:if test="${entry.isDel==0}">
								<a class="button border-red" href="${basepath }/product/del.do?id=${entry.id}&flag=0"><span class="icon-trash-o"></span> 删除</a>
							</c:if>
							<c:if test="${entry.isDel==1}">
								<a class="button border-green" href="${basepath }/product/del.do?id=${entry.id}&flag=1"><span class="icon-trash-o"></span> 找回</a>
							</c:if>
						</div>
					</td>
				</tr>
			</c:forEach>
			</tbody>
		</table>
	</div>
	<script src="${resourceServer }/js/page.js"></script>
	<div id="pagelist" class="pagelist">
	</div>

	<script type="text/javascript">
		$(function(){
			$("#pagelist").mypage({
				pageNo:${product.pageNo},
				params:"${product.params}",
				url:"${product.url}",
				totalPage:${product.pages}
			});
		});
	</script>
	</body>
</html>